home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CYBER.XPO.95
/
CYBER.XPO.95 (Arsenal Computer).ISO
/
popreq
/
amiga1
/
dcdd_20.lha
/
DCDD.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1994-01-27
|
23KB
|
829 lines
/*
DCDD.rexx 940127.2331
DIRECT_CONNECT_DEMON DIALER - Version 2.0
Use with Arexx Version 1.1 or better, BaudBandit 1.5 or better.
Jerry Smith - Fresno, CA. Contact BBS: F.A.A.X. (209) 226-7162
Not copyrighted, fully in the public domain.
Various bits and pieces lifted from other PD ARexx programs.
I would like to give special thanks to the following people:
Dave Mullenix for his GREAT series of ARexx programs for dialing PC
Pursuit. (Many of who's ideas are incorporated here)
Darcy McConnell for the use of his BBS for tests, tests, tests, etc....
Richard Stockton for his help with Arexx and BaudBandit.
My Wife and Best Friend (Diane) for her help, warmth and understanding.
*/
OPTIONS RESULTS
address BAUD
parse arg filename
TRUE = (1=1)
FALSE = ~ TRUE
EXIT_TIMER = 0
SPACER = ' '
if filename = '' then
DCDDPhone="DCDD"
else
DCDDPhone=filename
/* SHIFT F10 will stop this script before the next BBS is dialed
or break you out of a "stuck BBS" */
FKEY 'S10 \Mzap.continue.rexx'
/* GENERAL BAUDBANDIT SETTINGS BELOW */
mask on /* turns on mask */
/* mask off */
/* ansi on */
/* ansi off */
set F /* blanks screen w/form feed */
set 8N1 /* set modem to 8N1 */
set A /* set default to Z modem (auto DL) */
Auto OFF /* turn Auto_PhoneBook OFF */
Popup OFF /* You MUST have this in your default config or else have the
Phone Book screen getting in you way. (see DCDD.doc) */
screen off /* allows CON screen to come to the front */
Data 'RAM:-DL' /* set up default download area for downloaded files */
/* * * * * * * * * * * * * * * * * * * *
* * * Open a full sized window * * *
* * * * * * * * * * * * * * * * * * * */
windev = "CON:1/11/640/189/ Direct Connect Demon Dialer . . . . . . . . . . . . phonebook "DCDDPhone
if ~open('wind',windev) then exit /* Window for all activity */
NoError = 0
NoTimeout = 0
maxnumbers = 80 /* maximum number of entries in phonebook */
call J_Date /* creates JDATE for testing against julian date in
phonebook for transfer to GUI selection screen */
call ReadPhoneBk
call GetTotTime
temp= 'Hours used in' date(m)':' right(thours,2,'0')':'right(tmins,2,'0')':'right(tsecs,2,'0')
call wsaych(temp)
call wsay(' Select BBS(s):')
BBSelections = readln('wind')
screen on /* turns BaudBandit screen on */
send '\U' /* brings BaudBandit screen to the front - here and now!
The one in the main loop will bring the screen to the front
when a BBS is connected. */
/* below allows you to enter an "A" as the first character in your BBSelections
to activate the AUTO function in Do_WHOEVER.rexx scripts.
Please note that you can not mix AUTO and MANUAL selections in the same
session. I may change this if enough people ask for it.
See Do_FAAX.rexx for an example..... */
parse var BBSelections AUTO 2 .
if upper(AUTO) = 'A' then do
address command 'makedir RAM:AUTO'
msg '********** -------------------- **********'
msg '********** AUTO PROCESS STARTED **********'
msg '********** -------------------- **********'
call delay(100)
end
/* below allows BBS number(s) separated by ,./;:\|+-*# or space(s) */
y=translate(BBSelections,' ',',Aa./;:\|=+_*#')
bbs2call=0
do i = 1 to bbsnums
parse var y first y
bbs2call=bbs2call+1
bbs.i = first
if first == '' then leave /* breaks out of DO FOREVER loop */
end
bbs2call=bbs2call-1
msg ' '
msg bbs2call 'Selected BBSes to be Called'
msg_x_flag = ' '
do z=1 to bbs2call
t=bbs.z
msg_x = ' '
do /* below tests for AREXX SCRIPT in BBS for AUTO process */
if UPPER(AUTO) = 'A' then do
if bbs.t.script = ' ' then do
msg_x = '****** MISSING AREXX SCRIPT ******'
msg_x_flag = 'bad'
end
end
end
msg z':' bbs.t.name ' ' msg_x
end
if msg_x_flag = 'bad' then do
bbs2call = 0
msg ' '
msg ' '
msg '****** AUTO PROCESS ERROR - MISSING AREXX SCRIPT ******'
msg ' '
msg '10'
call delay(50)
msg ' 9'
call delay(50)
msg ' 8'
call delay(50)
msg ' 7'
call delay(50)
msg ' 6'
call delay(50)
msg ' 5'
call delay(50)
msg ' 4'
call delay(50)
msg ' 3'
call delay(50)
msg ' 2'
call delay(50)
msg ' 1'
call delay(50)
end
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Main Loop *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
listindex=1 ;
do while bbs2call ~= 0
indx = bbs.listindex
call CONTINUE_TEST
msg ''
if upper(AUTO) = 'A' then
msg 'AUTO >> Dialing:' bbs.indx.name
else
msg 'Dialing:' bbs.indx.name
bbsconnect = false
nresult = ' '
call at_codes /* send AT codes to modem for selected BBS. This is VERY
useful when using a SupraFAXmodem V32.bis at 14.4 */
if CallBBS(bbs.indx.phone) = NoTimeout then do
if pos('CARRIER',nresult) = 1 then do
call time(R)
dateYYYYMM=left(date(sorted),6)
dateYYMMDD=right(date(sorted),6)
timea=translate(time(n),' ',':')
parse value timea with timeHH timeMM timeSS .
timeHHMM=timeHH||timeMM
beep
send '\u' /* (pull screen to front when bbs connected)
You may or may not want to use this here. */
parse var bbs.indx.captitle CT PW1 PW2 LD TM MN SPD JDATE .
/* Capt "RAM:-dl below puts all Capture Logs in to this dir */
if CT ~= '' then
Capt 'RAM:-dl/'CT'.'dateYYMMDD'.'timeHHMM'.1'
/* above gives you files like OLD_DOC.930719.1718.1 - Had to add time so
that files opened up on RAM:-dl would not duplicate files in DH1:-dl
when they are transfered after logging out of a BBS. Really do need to
download into RAM when doing V32.bis 14.4 with a 68000 native CPU. */
if bbs.indx.script ~= '' then do
parse var bbs.indx.script title Xargs
msg 'Starting Arexx Script: ' title
if PW1 = ' ' then PW1 = 'NO_PW_1'
if PW2 = ' ' then PW2 = 'NO_PW_2'
if Xargs = ' ' then Xargs = ' NO_Xargs'
OUTargs = title||"("PW1||spacer||PW2||Xargs||")"
/* jws
msg '****************************************'
msg 'DCDD.rexx OUTargs = ' OUTargs
msg '****************************************'
call delay(600)
*/
interpret 'call' OUTargs
end
call DoPairs
call wait4disconnect
Capture OFF
/* items below copy ALL data in RAM:-dl to DH1:-dl
and then clears RAM:-dl for the next BBS called.
At the end of a days BBSing I create a file called DH1:-dl-YYMMDD
and copy the contents of DH1:-dl into it and then clear DH1:-dl
for the next days activity. */
/* BE SURE DH1: has room for the files you DL!!!!!!!!!!!!!!!!! */
address command 'copy RAM:-dl/#? DH1:-dl'
address command 'delete RAM:-dl/#?'
call removebbs /* remove bbs from selection group */
end
send '\d' /* drop DTR */
send '\ah' /* hangs up modem */
call selectnextbbs /* select next bbs from selection group */
end
call CONTINUE_TEST /* test for ram:continue as flag to continue or quit*/
if listindex > bbs2call then
listindex = 1
end
/* next two lines force DCDD.rexx to quit */
address command 'delete RAM:continue'
call CONTINUE_TEST
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Functions / Subroutines *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Continue_Test:
/* tests for RAM:continue as flag to continue or quit */
if exists('ram:continue')=0 then do
call delay(50)
msg ' '
msg ' '
msg '**************************************************'
msg '***** ******'
msg '***** EXITING * DIRECT CONNECT DEMON DIALER ******'
msg '***** ******'
msg '**************************************************'
capture OFF
call close('wind')
send '\d' /* drop DTR */
send '\ah' /* hangs up modem */
send '\aq' /* closes BaudBandit */
exit /* exits Arexx */
end
else do
call delay(10)
beep
call delay(10)
beep
end
return
AT_codes:
/* sends special AT codes for currently selected BBS to modem */
send 'AT&F2' /* resets modem to factory settings */
send '\w\r'
send 'AT&F2' /* resets modem to factory settings 2nd time */
send '\w\r' /* don't know why it needs it but it do! */
/* W1 below is necessary to set the CARRIER option so that the
baud rate at connect is captured. */
if bbs.indx.atcodes ~= '' then do
send 'AT W1 'bbs.indx.atcodes
send '\w\r'
msg 'AT codes sent to modem - ' bbs.indx.atcodes
end
else do
send 'AT M W1' /* M = speaker off, W1 = carrier - etc. */
send '\w\r'
end
return
Wsay:
/* put string to window with EOL */
parse arg strx
call writeln('wind',strx)
return
WsayCH:
/* put string to window without EOL */
parse arg strx
call writech('wind',strx)
return
DoPairs:
/* Have BaudBandit execute script pairs just like in Phonebook */
/* Some BBS software needs an ESCAPE key (or two) to load and this can be
taken care of using a Script Pair that starts like:
{Escape twice=\w\x1B\w\x1B\w\r}{....then your remaining stuff....
*/
if bbs.indx.pair ~= '' then do /* Do optional pairs after connect */
address BAUD
pairs bbs.indx.pair
end
return
wait4disconnect:
if bbs.indx.script = '' then do
msg ''
msg '+--------------------------------------+'
msg ' WAITING FOR 'bbs.indx.name' DISCONNECT '
msg '+--------------------------------------+'
end
call delay(150)
do forever
ADDRESS BAUD
dcd
/* note: RTEST holds RC value as RC resets after every Arexx command
is executed. */
RTEST = RC
if RTEST = 0 then leave /* breaks out of DO FOREVER loop */
call delay(250) /* 5 second delay for FOREVER loop */
/* below uses shift F10 to get out of a "STUCK BBS".
this routine also used for Arexx Script failed WAIT LOOP exiting.
Please note that this does NOT end the session just current BBS. */
if exists('ram:continue')=0 then do
msg '****** FORCED BBS LOGOFF BY USER ******'
address command 'makedir ram:continue'
call delay(50)
leave /* breaks out of DO FOREVER loop */
end
/* NOTE: process below replaced by NESTED DO FOREVER/WAIT LOOPS
see Do_FAAX.rexx for an example... */
/* below uses RAM:exit_flag to get out of a "STUCK BBS" when
you are using Arexx scripts for Auto late nite sessions
and want to be sure of exiting a BBS if they have changed
things and your script gets "HUNG UP". The EXIT_TIMER will
be reset to zero if RAM:exit_flag is absent. */
if exists('ram:exit_flag')=0 then do
exit_timer = 0
end
else do
exit_timer = exit_timer + 5
if exit_timer > 300 then do
msg '****** FORCED LOGOFF BY EXIT_TIMER ******'
call delay(50)
address command 'delete ram:EXIT_TIMER'
leave /* breaks out of DO FOREVER loop */
end
end
end
/*
below is old OLD way of holding till logged off BBS.
it had a "BIG" problem with matching text during DL's.
wait 'NO CARRIER'
*/
/* Get connection elapsed time from Arexx timer */
timeE=(time(e))
chours = timeE % 3600
choursrem = timeE // 3600
cmins = choursrem % 60
csecsx = choursrem // 60
csecs = csecsx % 1
cTOTAL = right(chours,2,'0')':'right(cmins,2,'0')':'right(csecs,2,'0')
msg 'Updating Total Time'
discotitle='DCDDdiscos.'dateYYYYMM
if open('discos',discotitle,'Append') = 0 then /* append if exists */
call open('discos',discotitle,'Write') /* else create file */
temp = dateYYMMDD timeHHMM cTOTAL CT SPEED bbs.indx.name
call writeln('discos',temp)
call close('discos')
/*
History file added so that this file will (when sorted) give you a
complete log of sessions on a BBS by BBS basis.
*/
htitle='DCDDhistory'
if open('hist',htitle,'Append') = 0 then /* append if exists */
call open('hist',htitle,'Write') /* else create file */
htemp = CT dateYYMMDD timeHHMM cTOTAL SPEED bbs.indx.name
call writeln('hist',htemp)
call close('hist')
/*
below reads in the Bandit.'DCDDPhone' file and re-writes it out to
ram:Bandit.'DCDDPhone'. During this process the bbs.j.captitle record
is updated for the BBS just visited for BBS activity tracking. This
will be used at the next session to display information on the BBS
selection screen so that you know how long ago you visited that BBS.
this process also updates the Bandit.'DCDDPhone' bbs.j.captitle record
for all BBSes with blank fields.
*/
call open('in1A','Bandit.'DCDDPhone,'r')
call open('out1A','ram:Bandit.'DCDDPhone,'W')
call J_DATE /* used to get JDATE at logoff point in BBS session */
/* Read BBS PhoneBook records */
do until EOF('in1A')
inline1A=readln('in1A')
if ~ EOF('in1A') then do
parse var inline1A DASHES 6 .
if DASHES = '-----' then
line_cnt = 0
line_cnt = line_cnt + 1
if line_cnt = 6 then do
parse var inline1A CTN PW1N PW2N LDN TMN MNN SPDN JDATEN .
if PW1N = ' ' then PW1N = 'NO_PW_1'
if PW2N = ' ' then PW2N = 'NO_PW_2'
if LDN = ' ' then LDN = 0
if TMN = ' ' then TMN = 0
if MNN = ' ' then MNN = 0
if SPDN = ' ' then SPDN = 0
if JDATEN = ' ' then JDATEN = JDATE - 1000
if CTN = CT then do
inline1A = CTN PW1N PW2N dateYYYYMMDD timeHHMM cTOTAL SPEED JDATE
end
else do
inline1A = CTN PW1N PW2N LDN TMN MNN SPDN JDATEN
end
end /* end for (if line_cnt = 6) */
call writeln('out1A', inline1A)
end /* end for (if ~ EOF) */
end /* end for (do until EOF) */
call close('in1A')
call close('out1A')
/* below copies temporary file from ram back over Bandit.'DCDDPhone' file
and then deletes it in ram. */
address command 'copy ram:Bandit.#? dh0:DemonDialer'
address command 'delete ram:Bandit.#?'
timetitle='DCDDtime.'dateYYYYMM
if open('TotTime',timetitle,'R')=0 then do /* Total hours, mins, secs */
thours = 0
tmins = 0 /* If file doesn't exist, set to zero */
tsecs = 0
end
else do
thours=readln('TotTime') /* If file does exist, read them */
tmins=readln('TotTime')
tsecs=readln('TotTime')
call close('TotTime')
end
msg 'Monthly total:' right(thours,2,'0')':'right(tmins,2,'0')':'right(tsecs,2,'0')
msg ' This call:' cTOTAL
nhours = chours+thours
if csecs > 0 then do /* the Damn phone company rounds */
cmins = cmins + 1 /* any seconds into a full minute */
csecs = 0
end
nmins = cmins+tmins
nsecs = csecs+tsecs
nmins=nmins+nsecs%60 ; nsecs = nsecs//60
nhours=nhours+nmins%60 ; nmins = nmins//60
/* If bbs.indx.local = LOCAL do not update TotTime */
parse var bbs.indx.local LFLAG 6 .
/* if bbs.indx.local = '' then do */
if LFLAG ~ = 'LOCAL' then do
call open('TotTime',timetitle,'W')
call writeln('TotTime', nhours)
call writeln('TotTime', nmins)
call writeln('TotTime', nsecs)
call close('TotTime')
msg ' --------'
msg ' New Total:' right(nhours,2,'0')':'right(nmins,2,'0')':'right(nsecs,2,'0')
end
else do
msg 'Local BBS - TotTime not updated'
end
return
removebbs:
/* Done with that bbs, change ALL occurances to "called" in selection group */
do j = 1 to bbs2call
if bbs.j = indx then do
bbs.j = 'called'
end
end
return
selectnextbbs:
/* Select the next available BBS from selection group */
yet2call = 0
wascalled = 0
do k = 1 to bbs2call
if bbs.k = 'called' then do
wascalled = wascalled + 1
end
else do
yet2call = yet2call + 1
end
end
if yet2call = 0 then do
bbs2call = 0
end
else do
loopcount = 0
do forever
listindex=listindex + 1
if listindex > bbs2call then
listindex = 1
loopcount = loopcount + 1
if bbs.listindex ~= 'called' then
leave /* breaks out of DO FOREVER loop */
if loopcount > 2 then do
msg '****** loopcount > 2 ******'
bbs2call = 0
leave /* breaks out of DO FOREVER loop */
end
end
livecount = 0
if yet2call ~= 0 or exists('ram:continue')=0 then do
msg ' '
msg yet2call ' BBSes yet to be called'
do z=1 to bbs2call
t=bbs.z
if bbs.z ~= 'called' then do
livecount = livecount + 1
msg livecount ':' bbs.t.name
end
end
end
end
return
CallBBS:
/* Dial Selected BBS */
arg number
call delay(25)
timeout 120 /* wait continues if no connectstring within 2 minutes */
send 'ATDT'number'\r'
call shownotes
connectstring='CARRIER 14400,CARRIER 12000,CARRIER 9600,CARRIER 7200,CARRIER 2400,BUSY,OK,NO CARRIER,NO DIALTONE'
wait connectstring
NRC = RC
NRESULT = RESULT
parse value NRESULT with AAA SPEED .
/* SPEED above used to capture arbitated carrier connect speed */
return NRC
shownotes:
/* Show BBS notes if present */
if bbs.indx.notenum > 0 then do
msg 'Notes for' bbs.indx.name':'
do notex = 1 to bbs.indx.notenum
msg bbs.indx.notes.notex
end
end
else do
msg 'No notes for' bbs.indx.name
end
msg ' '
return
GetTotTime:
/* gets total time for the month */
timetitle='DCDDtime.'left(date('S'),6) /* DCDDtime.YYYYMM */
if open('TotTime',timetitle,'R')=0 then do /* Total hours, mins, secs */
thours = 0
tmins = 0 /* If file doesn't exist, set to zero */
tsecs = 0
end
else do
thours=readln('TotTime') /* If file does exist, read them */
tmins=readln('TotTime')
tsecs=readln('TotTime')
call close('TotTime')
end
return
J_DATE:
dateYYYYMMDD = left(date(sorted),8)
parse var dateYYYYMMDD J_YYYY 5 J_MM 7 J_DD 9 .
if J_MM = 01 then JDATE = (J_YYYY * 365) + 000 + J_DD
if J_MM = 02 then JDATE = (J_YYYY * 365) + 031 + J_DD
if J_MM = 03 then JDATE = (J_YYYY * 365) + 059 + J_DD
if J_MM = 04 then JDATE = (J_YYYY * 365) + 090 + J_DD
if J_MM = 05 then JDATE = (J_YYYY * 365) + 120 + J_DD
if J_MM = 06 then JDATE = (J_YYYY * 365) + 151 + J_DD
if J_MM = 07 then JDATE = (J_YYYY * 365) + 181 + J_DD
if J_MM = 08 then JDATE = (J_YYYY * 365) + 212 + J_DD
if J_MM = 09 then JDATE = (J_YYYY * 365) + 243 + J_DD
if J_MM = 10 then JDATE = (J_YYYY * 365) + 273 + J_DD
if J_MM = 11 then JDATE = (J_YYYY * 365) + 304 + J_DD
if J_MM = 12 then JDATE = (J_YYYY * 365) + 334 + J_DD
if J_YYYY//4 = 0 then do
if J_MM > 2 then do
JDATE = JDATE + 1
end
end
return
ReadPhoneBk:
/* Read Phone Book into Arexx array */
call open('PhoDir','Bandit.'DCDDPhone,'r')
bbsnums = 0 /* Read BBS records */
inline1=readln('PhoDir')
do j=1 to maxnumbers until eof('PhoDir')
bbsnums = bbsnums + 1
bbs.j.name=strip(readln('PhoDir'))
bbs.j.phone=strip(readln('PhoDir'))
bbs.j.local=strip(readln('PhoDir'))
bbs.j.atcodes=strip(readln('PhoDir'))
bbs.j.captitle=strip(readln('PhoDir'))
bbs.j.script=strip(readln('PhoDir'))
bbs.j.pair=strip(readln('PhoDir'))
/* Read optional notes */
notex=0 ; inline1=''
do until inline1 = '-----' | EOF('PhoDir')
inline1=readln('PhoDir')
if inline1 ~= '-----' then do
notex = notex + 1
bbs.j.notes.notex = inline1
end
end
bbs.j.notenum = notex
/* Print BBS name */
parse var bbs.j.captitle CTN PW1N PW2N LDN TMN MNN SPDN JDATEN .
/* jws
if PW1N = ' ' then PW1N = 'NO_PW_1'
if PW2N = ' ' then PW2N = 'NO_PW_2'
if LDN = ' ' then LDN = 0
if TMN = ' ' then TMN = 0
if MNN = ' ' then MNN = 0
if SPDN = ' ' then SPDN = 0
*/
/* JDATE (below) is from initilization point at start of this session */
if JDATEN = ' ' then JDATEN = JDATE - 1000
JDIFF = JDATE - JDATEN
JX = '.'
if jdiff > 030 then JX = '-'
if jdiff > 060 then JX = '='
if jdiff > 090 then JX = 'x'
if jdiff > 365 then JX = '*'
if j//4 ~= 0 then do /* allows four across on CON window */
/*
I use bbs.j.captitle instead of bbs.j.name below because all my files
use the same name as my discos and capture files and I only have to
remember one name. The FULL name is used when you connect to a BBS
*/
call wsaych(right(j,2,' ') JX left(CTN,14,' '))
end
else
call wsay(right(j,3,' ') JX left(CTN,14,' '))
end
call close('PhoDir')
bbsnums=bbsnums-1
if bbsnums//2 = 0 then
call wsay('')
return